import 'dart:async';

import 'package:flutter/services.dart';
import 'package:my_plugins/alarm_event.dart';
export 'alarm_event.dart';

class MyPlugins {
  static const MethodChannel _channel = MethodChannel('my_plugins');

  static Future<String?> get platformVersion async {
    final String? version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  // ignore: slash_for_doc_comments
  /**
   * time 提醒时间
   * title  日历提醒标题
   * 
   */
  static Future<String> sendCalender(
      int time, String title, String desc) async {
    //  DateTime.now().millisecondsSinceEpoch
    final String version = await _channel.invokeMethod(
        'sendCalender', {'time': time, 'title': title, 'desc': desc});
    return version;
  }

  static Future<String> add2Alarm(AlarmEvent event) async {
    final String message =
        await _channel.invokeMethod('add2Alarm', event.toJson());
    return message;
  }
}
